<template>
	<view class="container">
		<u-navbar title="提现" :background="{ background: '#6EC9E1' }" :fixed="true" :border-bottom="false"
			title-color="#FFF" back-icon-color="#FFF">
		</u-navbar>
		<p class="a">可提现金额(元)</p>
		<p class="b">￥<span>{{money}}</span></p>
		<view class="c">
			<p>提现金额</p>
			<view class="take">
				<span>￥</span>
				<u-input :custom-style="{'font-size':'36px'}" :focus='true' placeholder-style="color:#fff"
					v-model="number" :border="false" />
				<text @click="number=money">全部提现</text>
			</view>
			<view class="btn" @click="TakeMoney">申请提现</view>
		</view>



		<view class="u-flex under u-font-10">
			<view>
				<view>1.开发票给平台，提现。</view>
				<view>2.不提现，有机会选择平台入股，代替股东投资款。</view>
			</view>

			<view class="popup-show" @click="show=true">
				提现流程
			</view>
		</view>
		<u-popup border-radius='30' :closeable='true' v-model="show" mode="bottom">
			<view class="popup-content">
				<view class="title">
					提现流程
				</view>
				<view class="u-p-30 " style="font-size: 24rpx;">
					<view> 1.关注微信公众号：深圳税务服务号。</view>
					<view>
						2.我要办-@深税-申报-微信快捷登录-人脸识别-返回深圳税务移动办税-个人-自然人代开发票-人脸识别-待申请-新增-线上开具（电子发票）-确定-经营地主管税务机关（深圳市福田区税务局）-街道乡镇（福田街道）-购方纳税人信息-名称（深圳市半边莲咨询有限公司）-货物或应税劳务、服务信息-名称（咨询服务费-金额（含税）（按实际填写，不能超过提现金额。）-计算税款（500元以上有增值税、城市维护建设税等）-提交-去缴款-立即缴款。
					</view>

					<view> 3.发票自动会发送到“半边莲咨询有限公司”。</view>
					<view>
						4.个人劳务报酬，月800元起征税，
						平台代扣代缴约20%个人所得税，交给国家税务。</view>
					<view>5.代扣代缴后，等待发票对应的银行卡到现。</view>

				</view>

				<view class="btn" @click="show=false">
					确定
				</view>
			</view>
		</u-popup>

	</view>
</template>

<script>
	import {
		withdrawal
	} from '@/api/index.js'
	export default {
		data() {
			return {
				number: '',
				money: 0,
				show: false
			}
		},
		watch: {
			number(e) {
				if (isNaN(e)) {
					uni.showToast({
						title: '请输入正确的数字',
						icon: 'none'
					})
					this.number = ''
				}
				if (e > this.money) {
					this.number = this.money
				}
				if (e < 0) {
					this.number = 0
				}
			}
		},
		onLoad(e) {
			this.money = e.money
		},
		methods: {
			
			TakeMoney() {
				withdrawal({
					money: this.number
				}).then(res => {

					if (res.code == 1) {
						uni.showToast({
							title: res.msg,
							icon: 'success',
							success() {
								setTimeout(() => {
									uni.redirectTo({
										url: '/sub/center/realname'
									})
									// uni.navigateBack()
								}, 1800)
							}
						})
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'error'
						})
					}
				})
			}
		}
	}
</script>

<style lang="less">
	.container {
		height: 100vh;
		background: url('../../static/img/mine/header-bg.png');
		background-size: 100% 35vh;
		background-repeat: no-repeat;
		padding: 30rpx;
		font-size: 14px;
	}

	p {
		color: #fff;
	}

	.a {
		opacity: 0.6;
		padding-left: 4px;
	}

	.b {
		font-size: 24px;
		margin-top: 4px;

		span {
			font-size: 36px;
		}
	}

	.c {
		background: #fff;
		border-radius: 6px;
		padding: 30rpx;
		margin-top: 30px;

		.take {
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 0.5px solid #EDEDED;
			padding: 10rpx 0;

			span {
				font-size: 40px;
			}

			text {
				color: #6EC9E1;
				min-width: 56px;
			}

			u-input {
				width: 100%;
			}
		}

		.btn {
			width: 100%;
			border-radius: 30px;
		}
	}


	.under {
		width: 100vw;
		padding: 25rpx 35rpx;
		color: #98A8AC;
		background-color: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		flex-flow: column;
		z-index: 999;

		.popup-show {
			text-align: center;
			width: 40vw;
			padding: 10rpx;
			margin: 10rpx auto;
			color: #53C8D3;
			border-radius: 236px;
			box-sizing: border-box;
			border: 0.5px solid #6EC9E1;
		}
	}

	.popup-content {
		padding: 30rpx;
		color: #3D3D3D;
		line-height: 30px;

		.title {
			font-size: 20px;
			text-align: center;
			color: #000000;
		}

		.btn {
			border-radius: 30px;
		}
	}
</style>